The Elder Scrolls Forums

TES Construction Set and Plugins >> General TES Construction Set

Pages: 1
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Experiments with Targetted Scripts
      #2840186 - 07/23/04 03:37 PM

Hello boys and girls. Today we are experimenting with Targetted Global Scripts. As you can see, Targetted Script can access the NPC like a normal script *demonstrates with GetPos*

Ok, now let's see if they can access local variables.

*attempts*

Oh dear. It doesn't work. I don't suppose if anyone knows if Targetted scripts can access the variables in the objects local script? 'twould be most helpful (I'm trying to have multiple targetted scripts running on different NPCs at the same time, which means there need to be unique variables for each of them somewhere. Local ones would be easiest. I can do another way if I have to, but I'd prefer not).


Today's insanity was brought to you by...

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2840206 - 07/23/04 03:44 PM

Oh... My other way of doing it won't work. >_< Ok... Umm.... Ahah! I have another other way. Nevermind ^_^

Still, I'd prefer to use local script variables

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
GhanBuriGhan
Diviner

Reged: 10/06/01
Posts: 2977
Loc: Behind that tree!
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2840266 - 07/23/04 04:02 PM

Not sure how your problem is set up , but maybe you can set the values in the global script from the local ones:

set Global_script_name.variable to 1

You can use things like silent sounds and GetSoundPlaying to detect which script is running on your NPC.



--------------------
--//Forum Scholars guild\\--
MW Scripting for Dummies, Traveling Merchants, Combat Moves:
The Lys
World of Faces Mod


Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: GhanBuriGhan]
      #2840302 - 07/23/04 04:11 PM

Ack.

Ack.

Ack.

You just made me realise something. The global script will only run through once per frame. I was thinking it would run for each NPC.

Oh well... back to the drawing board.

Unless it will run for each NPC.... I hate testing >_<

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2840385 - 07/23/04 04:45 PM

Grrr... only runs once. Can't even start and stop it for each NPC. Still only runs once. So much for a generic global script.

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
ManaUser
Master

Reged: 06/01/00
Posts: 6095
Loc: Long Beach, CA, USA
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2840390 - 07/23/04 04:46 PM

No, you're right. Only one copy of a global script can run at a time.

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: ManaUser]
      #2840413 - 07/23/04 04:54 PM

That's really disappointing. I was hoping to create a cooking (among other things) script, and all I would have to do is start it on someone and they would start cooking. Now I'll have to put the code in the person's individual script (along with all the other things they can do)

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
TMTY_Lizard
Adept

Reged: 05/30/03
Posts: 304
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2840845 - 07/23/04 08:15 PM

You could just make clones of the global script like ArrilleCooking and MeldorCooking. I know it's a bit more bloated but it makes adding functionality to an NPC a lot more tidy. As long as you're sure to stop the global scripts when not needed it might be ok.

--------------------
New to the forums? Looking for something? Before asking, one of these might help...
Main Index|Search|My Home|Who's Online|FAQ|Logout|Mark All Read
Can you guess which?

Fashionable Merchants 1.0
Available at http://morrowind.matterofopinion.net/

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: TMTY_Lizard]
      #2840871 - 07/23/04 08:28 PM

That's true. I think I will do that.

It's annoying that I still need seperate ones though. Oh well

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
GhanBuriGhan
Diviner

Reged: 10/06/01
Posts: 2977
Loc: Behind that tree!
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2840876 - 07/23/04 08:32 PM

Will there ever be two such NPC that the player is close to at the same time? If not, you can just automatically stop the global script, e.g.when the player leaves the cell, or is a certain distance away. Then the global is available agin for the next cook the player encounters.

--------------------
--//Forum Scholars guild\\--
MW Scripting for Dummies, Traveling Merchants, Combat Moves:
The Lys
World of Faces Mod


Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: GhanBuriGhan]
      #2840947 - 07/23/04 09:03 PM

I want to be safe and assume there could be.

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
GhanBuriGhan
Diviner

Reged: 10/06/01
Posts: 2977
Loc: Behind that tree!
Re: Experiments with Targetted Scripts [Re: Thepal]
      #2841419 - 07/24/04 12:56 AM

You could still use something like my combat moves plugin with 3 or 4 copies of the global script (scripts a-d) for safety: it checks whether
a) the NPC already has a script running
b) if not whether the global script a-d are already running

Starts a targeted script that is currently not in use on the NPC (and stops it again based on distance). That is fairly safe, if you can estimate the maximum number of NPC's that you could have at the same time.





--------------------
--//Forum Scholars guild\\--
MW Scripting for Dummies, Traveling Merchants, Combat Moves:
The Lys
World of Faces Mod


Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
TMTY_Lizard
Adept

Reged: 05/30/03
Posts: 304
Re: Experiments with Targetted Scripts [Re: GhanBuriGhan]
      #2841640 - 07/24/04 02:06 AM

You see why people like GBG have my respect; they think up neat little workarounds and doges that I really like. It's the background in formal Philosophy - I love tricksy little loopholes . And it makes them good scripters.

--------------------
New to the forums? Looking for something? Before asking, one of these might help...
Main Index|Search|My Home|Who's Online|FAQ|Logout|Mark All Read
Can you guess which?

Fashionable Merchants 1.0
Available at http://morrowind.matterofopinion.net/

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
FreshFish
Acolyte

Reged: 09/07/02
Posts: 142
Re: Experiments with Targetted Scripts [Re: GhanBuriGhan]
      #2841974 - 07/24/04 03:58 AM

Or...

Write the global script so that it does not care whether it runs every frame or not and make it self terminating each frame so the script can pick up from whichever state it is in and do the apropriate things in a single 'hit'. Then you can call this script on your target at any time and if it doesnt run on your target this frame try again next frame until it fires.

Now where to store the state while running the same script on multiple NPCs, how about all those unused stats, I dont think the NPC will mind if you boost his resistcorprus stat to whichever value you like. And it works in savegames too pretty much.

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Thepal
Disciple

Reged: 06/21/03
Posts: 1359
Loc: Gold Coast, Australia
Re: Experiments with Targetted Scripts [Re: GhanBuriGhan]
      #2843266 - 07/24/04 10:14 AM

Quote:

You could still use something like my combat moves plugin with 3 or 4 copies of the global script (scripts a-d) for safety: it checks whether
a) the NPC already has a script running
b) if not whether the global script a-d are already running

Starts a targeted script that is currently not in use on the NPC (and stops it again based on distance). That is fairly safe, if you can estimate the maximum number of NPC's that you could have at the same time.




Yeah, I thought of that. I think I'll just do individual scripts though. That will let me code in locations of things which will make it all easy. I need to stop thinking complex.

--------------------
-==Thepal==-

Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php

Post Extras: Print Post   Remind Me!   Notify Moderator   Email Post
Pages: 1


Extra information
4 registered and 0 anonymous users are browsing this forum.

Moderator:  Umrahel, Freddo, Pete, klendathu, Lady Eternity, Locklear93, Hungry Donner, Attrebus, Miltiades, slateman, tegger, Archeopterix 

Favorite Thread! (toggle)
Print Thread

Permissions
      You can start new topics
      You can reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 108

Rate this thread
 
Jump to

The Elder Scrolls Homepage

*
UBB.threads™ 6.3

Click for Privacy Statement © 2003 Bethesda Softworks LLC, a ZeniMax Media company. All Rights Reserved.
PRIVACY POLICY | TERMS & CONDITIONS | LEGAL INFORMATION | CONTACT US